-
Notifications
You must be signed in to change notification settings - Fork 42
Remove asyncio usage in jobs monitoring #796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Most of the calls inside the async wrappers are blocking: sync rest calls and system calls. So asyncio only adds a level of complexity without bringing any benefit.
📝 WalkthroughWalkthroughThe codebase transitions from asynchronous to synchronous execution patterns across multiple subsystems. Async methods are converted to sync equivalents using time.sleep instead of asyncio.sleep, WebSocket handling shifts to synchronous clients, and dev dependencies are updated to remove pytest-asyncio. Public method signatures throughout the codebase change from async to sync. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cloudai/_core/base_runner.py (1)
120-130:⚠️ Potential issue | 🟠 Major
delayed_submit_testnow blocks the monitor loop for its entire delay.Previously with asyncio,
delayed_submit_testwas scheduled as a concurrent task — the monitor loop continued while the delay elapsed. Nowtime.sleep(delay)blocks the calling thread. This matters when multiple dependent tests are triggered (e.g., inhandle_dependenciesat Line 346 orcheck_and_schedule_start_post_init_dependent_testsat Line 179): each call blocks fordelayseconds sequentially, stalling the entire monitoring loop forN × 5seconds.If this is acceptable given the workloads, no change needed — but it's a behavioral regression from the async version worth acknowledging.
Alternative: submit immediately with an initial grace period tracked per-job
One option is to remove the sleep entirely and track a
not_beforetimestamp on the test run, deferring actual submission until the next monitor iteration after the delay has elapsed. This preserves the delay semantics without blocking the loop.
Greptile OverviewGreptile SummaryThis PR removes Key integration points are Blocking issues to fix before merge:
Confidence Score: 2/5
Important Files Changed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 5 comments
Additional Comments (2)
Also appears in the same flow when
This affects log collection on job completion (src/cloudai/systems/runai/runai_runner.py:44-50). |
Summary
Most of the calls inside the async wrappers are blocking: sync rest calls and system calls. So
asyncioonly adds a level of complexity without bringing any benefits.Test Plan
conf/common+ some private ones.Additional Notes
–